package com.sluggard.ai.controller;

import com.sluggard.ai.model.req.ChatReq;
import com.sluggard.ai.service.ChatService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

import java.util.concurrent.ExecutionException;

/**
 * 类描述：
 *
 * @author lizheng
 * @created 2025/4/22 16:46
 */
@RestController
@RequestMapping
public record ChatController(ChatService chatService) {

    @PostMapping("/chat/stream")
    public Flux<String> chatStream(@RequestBody ChatReq chatReq) throws ExecutionException, InterruptedException {
        return chatService.chatStream(chatReq);
    }

}
